refactor(hlo): make HloGenerator core API multiplatform#730
Merged
Conversation
Move HloGenerator tracing and StableHLO conversion into commonMain, keep JVM blocking and descriptor helpers in jvmMain, and add common coverage for StableHLO generation. Closes #665 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #665.
Moves the core
HloGenerator.generate(model, sampleInput, functionName)workflow out ofjvmMainand intocommonMain, making StableHLO export available to all KMP targets (jvm, ios, linux, macos). The tracing →ComputeGraph→ StableHLO MLIR pipeline has no JVM-specific dependencies, so it now lives in common code.Changes
commonMain:HloGenerator.kt(core suspendgenerate(...)API) moved here fromjvmMain.jvmMain: newHloGeneratorJvm.ktkeeps the JVM conveniences —generateBlocking(...)blocking wrapper (extension +JvmHloGeneratorJava facade) and the internalModelDescriptoroverload used by the CLI.HloGeneratorMain.ktCLI unchanged.commonTest: newHloGeneratorCommonTest.ktvalidates the platform-neutral export path (traces a square model, asserts emittedstablehlo.multiply+ function/tensor types).skainet-lang-modelspromoted tocommonMain; coroutines-test added tocommonTest..api: regenerated for the relocated symbols.Acceptance criteria (#665)
commonMainVerification
./gradlew :skainet-compile:skainet-compile-hlo:jvmTest :skainet-compile:skainet-compile-hlo:apiCheck→ BUILD SUCCESSFUL (compiles for jvm + iosArm64 + iosSimulatorArm64 + macosArm64 + linuxX64 + linuxArm64).🤖 Generated with Claude Code